import { createBrowserRouter, createHashRouter } from 'react-router-dom'
import { lazy } from 'react'

const Login = lazy(() => import('@/view/Login'))
const Layout = lazy(() => import('@/view/Layout'))
const NotFound = lazy(() => import('@/view/NotFound'))
const User = lazy(() => import('@/view/User'))
const Swiper = lazy(() => import('@/view/Swiper'))
const Goods = lazy(() => import('@/view/Goods'))
const Echarts = lazy(() => import('@/view/ECharts/echarts'))
const EChartsThird = lazy(() => import('@/view/ECharts/echarts-third'))
const Editor = lazy(() => import('@/view/Editor'))
const Baidu = lazy(() => import('@/view/Map/baidu'))
const BaiduThird = lazy(() => import('@/view/Map/baidu-third'))
const routes = [
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        path: 'user/list',
        element: <User />
      },
      {
        path: 'swiper/list',
        element: <Swiper />
      },
      {
        path: 'goods/list',
        element: <Goods />
      },
      {
        path: 'visible/echarts',
        element: <Echarts />
      },
      {
        path: 'visible/echarts-third',
        element: <EChartsThird />
      },
      {
        path: 'editor/submit',
        element: <Editor />
      },
      {
        path: 'map/baidu',
        element: <Baidu />
      },
      {
        path: 'map/baidu-third',
        element: <BaiduThird />
      }
    ]
  },
  {
    path: '/layout',
    element: <Layout />
  },
  {
    path: '*',
    element: <NotFound />
  }
]
const router = createBrowserRouter(routes)
// const router = createHashRouter(routes)

export default router
